﻿using EkStudio.com.bean.xml.BillModule;
using EkStudio.com.bean.xml.reflection;
using EkStudio.com.bean.xml.RootInterface;
using EkStudio.com.bean.xml.RootInterface.DataSource;
using EkStudio.com.bean.xml.RootInterface.FieldEvent;
using EkStudio.com.bean.xml.RootInterface.language;
using EkStudio.com.bean.xml.WorkFlow.Node;
using EkStudio.com.common.unit;

namespace EkStudio.com.bean.xml.WorkFlow
{
    [XmlRootElement("root")]
    public class WflowModuleItem : BillFormatModule
    {

        private bool readOnly = false;

        private WflowModuleRoot workflow = null;

        private WflowModuleNodeRoot flowNode = null;

        private WflowModuleEventRoot flowEvent = null;

        private BillFieldsI18nRoot i18nProperties = null;



        [XmlElement]
        public WflowModuleRoot Workflow
        {
            get { return workflow; }
            set { workflow = value; }
        }
        [XmlElement]
        public WflowModuleNodeRoot FlowNode
        {
            get { return flowNode; }
            set { flowNode = value; }
        }
        [XmlElement]
        public WflowModuleEventRoot FlowEvent
        {
            get { return flowEvent; }
            set { flowEvent = value; }
        }

        [XmlElement]
        public BillFieldsI18nRoot I18nProperties
        {
            get { return i18nProperties; }
            set { i18nProperties = value; }
        }



        [XmlTransient]
        public BillDataFillRoot DataFill
        {
            get { return null; }

            set { }
        }

        [XmlTransient]
        public BillSourceRoot DataSource
        {
            get
            {
                return null;
            }

            set
            {
                
            }
        }
        [XmlTransient]
        public object ParentBean
        {
            get
            {
                return null;
            }

            set
            {
            }
        }
        [XmlTransient]
        public BillUiGroupRoot UiField
        {
            get
            {
                return null;
            }

            set
            {
                
            }
        }

        

        public object Clone()
        {
            WflowModuleItem clone = new WflowModuleItem();
            if (workflow != null) clone.Workflow = workflow.Clone() as WflowModuleRoot;
            if (flowNode != null) clone.FlowNode = flowNode.Clone() as WflowModuleNodeRoot;
            if (flowEvent != null) clone.flowEvent = flowEvent.Clone() as WflowModuleEventRoot;
            return null;
        }

        public int getBillType()
        {
            return ProjectUtil.TYPE_BILL_WORKFLOW;
        }

        public string getCaption()
        {
            return this.workflow.Caption;
        }

        public string getJavaPackage()
        {
            return workflow.JavaPackage;
        }

        public string getKey()
        {
            return workflow.Key;
        }

        public string getLanguageText()
        {
            return workflow.LanguageTexts;
        }

        public string getVersion()
        {
            return workflow.RootVersion;
        }

        public bool isReadOnly()
        {
            return readOnly;
        }

        public void setReadOnly(bool read)
        {
            readOnly = read;
        }
    }
}
